<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>Tables - Ace Admin</title>

<meta name="description" content="Static &amp; Dynamic Tables" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<!-- bootstrap & fontawesome -->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/font-awesome.min.css" />
<!-- page specific plugin styles -->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/chosen.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-datepicker3.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-timepicker.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/daterangepicker.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-colorpicker.min.css" />


<!-- ace styles -->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/ace.min.css"
	id="main-ace-style" />


<!--[if lte IE 9]>
			<link rel="stylesheet" href="<%=request.getContextPath()%>/ace/assets/css/ace-part2.min.css" />
		<![endif]-->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/ace-skins.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/ace-rtl.min.css" />

<!--[if lte IE 9]>
		  <link rel="stylesheet" href="<%=request.getContextPath()%>/ace/assets/css/ace-ie.min.css" />
		<![endif]-->

<!-- inline styles related to this page -->

<!-- ace settings handler -->
<script
	src="<%=request.getContextPath()%>/ace/assets/js/ace-extra.min.js"></script>

<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

<!--[if lte IE 8]>
		<script src="<%=request.getContextPath()%>/ace/assets/js/html5shiv.min.js"></script>
		<script src="<%=request.getContextPath()%>/ace/assets/js/respond.min.js"></script>
		<![endif]-->

<script src="<%=request.getContextPath()%>/ace/assets/js/jquery-2.1.4.min.js"></script>
<script src="<%=request.getContextPath()%>/ace/assets/js/bootbox.js"></script>
<script type="text/javascript">
function price(url,price){
	bootbox.prompt({
	    title: "请输入价格!",
	    value:price,
	    inputType: 'number',
	    locale: "zh_CN",
	    callback: function (result) {
	    	if(result<0){
	    		bootbox.alert("问题价格不能为负数");
	    		return false;
	    	}
	    	if(result ==''){
	    		bootbox.alert("问题价格不能为空");
	    		return false;
	    	}
	    	if(result != null){
		    	$.ajax({
		             type: "POST",
		             url: url,
		             data: {price:result},
		             dataType: "json",
		             success: function(data){
		                        if(data){
		                        	bootbox.alert("价格修改成功", function(){ window.location.reload(); })
		                        }else{
			                        bootbox.alert("修改失败")
		                        }
		                      },
		             fail: function(data){
		            	 bootbox.alert("系统繁忙，请联系管理员")
		                      }
		         });
	    		
	    	}
	    }
	});
}
	
</script>
</head>

<body class="no-skin">
	<c:if test="${not empty msg}">
    	<div id="myAlert" class="alert alert-warning">
			<a href="#" class="close" data-dismiss="alert">&times;</a>
			<strong>警告！</strong>${msg }。
		</div>
	</c:if>
<div class="breadcrumbs" id="breadcrumbs">

		<ul class="breadcrumb">
			<li><i class="ace-icon fa fa-home home-icon"></i> <a >当前位置</a>
			</li>

			<li><a href="<%=request.getContextPath()%>/bsbExpertQu/list.do">语音专区列表</a></li>
			
		</ul>
		

	</div>
	<div class="page-content">
		<!-- /section:settings.box -->
		<div class="page-content-area">
			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					<div class="row">
						<div class="col-xs-12">
							<div class="table-header">问答专区</div>

							<!-- <div class="dataTables_borderWrap"> -->
							<div>
								<div id="sample-table-2_wrapper"
									class="dataTables_wrapper form-inline no-footer">
									<form action="<%=request.getContextPath()%>/bsbExpertQu/list.do"
										method="get" id="drizzt-table">
										<div class="row">
											<div class="col-xs-6">
												<table cellspacing="0" cellpadding="0" border="0"
													style="float: left; table-layout: auto;"
													class="ui-pg-table navtable">
													<tbody>
														<tr>
														<c:if test="${firmId==10000 }">
														 <shiro:hasPermission name="bsbExpertQu:create">
																<td class="ui-pg-button ui-corner-all" title=""
																	id="add_grid-table" data-original-title="Add new row"><div
																		class="ui-pg-div">
																		<a  class="btn btn-sm btn-primary" href="<%=request.getContextPath()%>/bsbExpertQu/create.do"  >上传语音</a>
																	</div></td>
																<td>&nbsp;&nbsp;</td>
															</shiro:hasPermission>
														</c:if>
															
														</tr>
													</tbody>
												</table>
											</div>
											<div class="col-xs-12">
											<div class="col-xs-3">
												<div class="input-group input-group-sm  pull-left">
												
										            <span class="input-group-addon">问题标题:</span>
										            <input type="text" class="form-control" name="question" width="170" value="${question }"  placeholder="问题标题">
										        </div>
										       </div>
										       
										       <div class="col-xs-3">
												<div class="input-group input-group-sm  pull-left">
												
										            <span class="input-group-addon">商&nbsp;&nbsp;品&nbsp;id</span>
										            <input type="text" class="form-control" name="quid" width="170" value="${quid }"  placeholder="商品id">
										        </div>
										       </div>
										     
										        
										        <div class="col-xs-3">
										           <div class="input-group input-group-sm  pull-left">
												
										            <span class="input-group-addon">发&nbsp;&nbsp;布&nbsp;人</span>
										            <input type="text" class="form-control" width="170" name="name" value="${name }"  placeholder="发布人">
										        </div>
										        </div>
										        <div class="col-xs-3">
										        <div class="input-group input-group-sm  pull-left" >
												
										            <span class="input-group-addon">显示状态</span>
										            <select name="delflag"  style='width:160px'>
												      <option value="">全部</option>
												      <option value="0" <c:if test="${delflag=='0' }">selected</c:if> >显示</option>
												      <option value="1" <c:if test="${delflag=='1' }">selected</c:if> >隐藏</option>
												    </select>
										        </div>
										        </div>
										        
										 
										        		
											</div>
											<div class="col-xs-12">
											<div class="col-xs-3">
										        	<div class="input-group input-group-sm  pull-left">
													<span class="input-group-addon">审核状态:</span>
														<select name="status"  style='width:160px'>
															<option value="">请选</option>
															<option value="0" <c:if test="${status=='0' }">selected</c:if>>待审核</option>
															<option value="1" <c:if test="${status=='1' }">selected</c:if>>审核通过</option>
															<option value="2" <c:if test="${status=='2' }">selected</c:if>>审核未通过</option>
															<option value="3" <c:if test="${status=='3' }">selected</c:if>>补录审核中</option>
															<option value="4" <c:if test="${status=='4' }">selected</c:if>>补录审核通过</option>
															<option value="5" <c:if test="${status=='5' }">selected</c:if>>补录审核未通过</option>
														</select>
														
													</div>
										        </div>
										     
											
										        
												  <div class="col-xs-3">
											 <div class="input-group input-group-sm  pull-left">
												
										            <span class="input-group-addon">所属行业</span>
										          	<select name="trade" class="country"  style='width:160px' >
															<option value="">--选择行业--</option>
															<c:forEach items="${trades }" var="tr">
																<option value="${tr.uuid }" <c:if test="${tr.uuid==trade  }">selected</c:if>>${tr.name }</option>
															</c:forEach>
														</select>
										        </div>
										        </div>
										          <div class="col-xs-3">
										           <div class="input-group input-group-sm pull-left">
												
										            <span class="input-group-addon">所属税种</span>
										          		<select name="tax"  style='width:160px'>
															<option value="">--选择税种--</option>
															<c:forEach items="${taxs }" var="ta">
																<option value="${ta.uuid }" <c:if test="${ta.uuid==tax  }">selected</c:if>>${ta.name }</option>
															</c:forEach>
														</select>
										        </div>
										        </div>
										          <div class="col-xs-3">
										         <div class="input-group input-group-sm  pull-left">
												
										            <span class="input-group-addon">所属专题</span>
										        	 <select name="topic" class="country" style='width:160px'>
															<option value="">--选择专题--</option>
															<c:forEach items="${topics }" var="to">
																<option value="${to.uuid }" <c:if test="${to.uuid==topic  }">selected</c:if>>${to.name }</option>
															</c:forEach>
														</select>
										        </div>
										        </div>
										        </div>
										        <div class="col-xs-12">
										           <div class="col-xs-6">
													<div class="input-group input-group-sm pull-left">
													
													 
										        	<span class="input-group-addon">发布日期:</span>
										        	
										        	
														<div class="input-daterange" data-date-format="yyyy-mm-dd" id="datepicker">
														    <input type="text" class="input-sm form-control" width="170" name="start" placeholder="起始日期" value="${start }"/>
														  
														    <span class="">--</span>
														    <input type="text" class="input-sm form-control" width="170" name="end" placeholder="截止日期" value="${end }"/>
														</div>
								
													</div>
													</div>
													
													 <div class="col-xs-3">
													<div class="input-group input-group-sm">
													<c:if test="${firmId==10000 }">
												 <shiro:hasPermission name="bsbExpertQu:firmname">
										            <span class="input-group-addon">所属机构</span>
										            <input type="text" class="form-control" name="firm" value="${firm }"  placeholder="所属机构">
										            </shiro:hasPermission>
										            </c:if>
										        </div>
										        </div>
										        <div class="input-group input-group-sm pull-left">
													<button type="button" onclick="search()" class="btn btn-purple btn-sm">
														<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
														搜索
													</button>
													</div>
											</div>
										</div>
										<table style="table-layout:fixed;"
											class="table table-striped table-bordered table-hover dataTable no-footer"
											id="sample-table-2" role="grid"
											aria-describedby="sample-table-2_info">
											<thead>
												<tr role="row">
														<th width="10%" class="sorting_disabled center">商品id</th>
														<th width="10%" class="sorting_disabled center">问题标题</th>
														<th width="6%" class="sorting_disabled center">金额</th>
														<th width="10%" class="sorting_disabled center">发布日期</th>
														<th width="8%" class="sorting_disabled center">审核状态</th>
														<th width="8%" class="sorting_disabled center">所属行业</th>
														<th width="8%" class="sorting_disabled center">所属税种</th>
														<th width="8%" class="sorting_disabled center">所属专题</th>
														<th width="7%" class="sorting_disabled center">发布人</th>
														<th width="7%" class="sorting_disabled center">所属机构</th>
														<th width="8%" class="sorting_disabled center">显示状态</th>
													<th width="10%" class="sorting_disabled center">操作</th>
												</tr>
											</thead>
													<!-- status.index+1 -->
											<tbody>
												<c:forEach items="${bsbExpertQus}" var="bsbExpertQu" varStatus="status">
													<tr role="row" class="odd">
													
															<td style="word-break:break-all">${bsbExpertQu.uuid}</td>
															<td style="overflow:hidden;text-overflow:ellipsis;white-space: nowrap; ">${bsbExpertQu.question}</td>
															<td>${bsbExpertQu.quPrice}</td>
															<td><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${bsbExpertQu.createDate}" /></td>
															<td>${bsbExpertQu.status=='0'?'待审核':bsbExpertQu.status=='1'?'审核通过':bsbExpertQu.status=='2'?'审核不通过':bsbExpertQu.status=='3'?'补录待审核':bsbExpertQu.status=='4'?'补录审核通过':bsbExpertQu.status=='5'?'补录审核不通过':'未知'}</td>
															<td>${bsbExpertQu.trade}</td>
															<td>${bsbExpertQu.tax}</td>
															<td>${bsbExpertQu.topic}</td>
															<td>${bsbExpertQu.userName}</td>
															<td>${bsbExpertQu.firmName}</td>
															<td>${bsbExpertQu.delFlag=='0'?'显示':bsbExpertQu.delFlag=='1'?'隐藏':'未知'}</td>
														<td>
										                    <shiro:hasPermission name="bsbExpertQu:view">
										                        <a class="blue"  href="<%=request.getContextPath()%>/bsbExpertQu/${bsbExpertQu.uuid}/view">
																	<i class="ace-icon fa fa-search-plus bigger-130"></i>查看
																</a>
										                    </shiro:hasPermission><br>
										                    <c:if test="${firmId==10000 }">
										                      <c:if test="${bsbExpertQu.status=='0' or bsbExpertQu.status=='3'}">
											                    <shiro:hasPermission name="bsbExpertQu:check">
											                        <a class="green" href="<%=request.getContextPath()%>/bsbExpertQu/${bsbExpertQu.uuid}/check">
																		<i class="ace-icon fa fa-pencil bigger-130"></i>审核
																	</a>
											                    </shiro:hasPermission><br>
										                    </c:if>
										                    </c:if>
										                  
										                    <c:if test="${firmId==10000 }">
										                     <shiro:hasPermission name="bsbExpertQu:price">
										                        <a class="green" style="cursor:  pointer" id="bootbox-confirm" rel="<%=request.getContextPath()%>/bsbExpertQu/${bsbExpertQu.uuid}/price"  onclick="javascript:price(this.rel,${bsbExpertQu.quPrice});" >
																	<i class="ace-icon fa fa-pencil bigger-130"></i>价格
																</a>
										                    </shiro:hasPermission><br>
															
										                     <shiro:hasPermission name="bsbExpertQu:update">
										                        <a class="green" href="#" onclick="javascript:goOperate('edit','${bsbExpertQu.uuid}')"  >
																	<i class="ace-icon fa fa-pencil bigger-130"></i>编辑
																</a>
															
										                    </shiro:hasPermission><br>
										                    </c:if>
										                    <shiro:hasPermission name="bsbExpertQu:delete">
																<c:if test="${bsbExpertQu.delFlag==0}">
											                    	<a class="red"  href="#" onclick="javascript:goOperate('hide','${bsbExpertQu.uuid}')">
																		<i class="ace-icon fa fa-eye-slash bigger-130"></i>隐藏
																	</a>
										                    	</c:if>
										                    	<c:if test="${bsbExpertQu.delFlag==1}">
											                    	<a class="red" href="#"  onclick="javascript:goOperate('show','${bsbExpertQu.uuid}')">
																		<i class="ace-icon fa fa-eye bigger-130"></i>显示
																	</a>
										                    	</c:if>
										                    </shiro:hasPermission>
										                </td>
													</tr>
												</c:forEach>
											</tbody>
										</table>
										<div class="row">
											<div class="col-xs-6">
												<div class="dataTables_info" id="sample-table-2_info"
													role="status" aria-live="polite">
													共 ${totalCount} 条数据，当前第<input type="text" id="pageNum"
														name="pageNum" style="width: 40px;" value="${pageNum}" />页&nbsp;&nbsp;
													<input type="button" class="btn btn-sm btn-primary" onclick="goPage($('#pageNum').val())" value="跳转"></input>
												</div>
											</div>
											<div class="col-xs-6">
												<div class="dataTables_paginate paging_simple_numbers"
													id="sample-table-2_paginate">
													<ul class="pagination">
														<li class="paginate_button <c:if test="${pageNum==1}">disabled</c:if>"
															aria-controls="sample-table-2" tabindex="0"
															id="sample-table-2_previous"><a href="javascript:void(0)"
															onclick="goPage(1)">首页</a></li>
														<li class="paginate_button <c:if test="${pageNum==1}">disabled</c:if>"
															aria-controls="sample-table-2" tabindex="0"
															id="sample-table-2_previous"><a href="javascript:void(0)"
															onclick="goPage(${pageNum}-1)">上一页</a></li>
														<li class="paginate_button <c:if test="${pageNum==maxPageNum}">disabled</c:if>" aria-controls="sample-table-2"
															tabindex="0" id="sample-table-2_previous"><a
															href="javascript:void(0)" onclick="goPage(${pageNum}+1)">下一页</a></li>
														<li class="paginate_button <c:if test="${pageNum==maxPageNum}">disabled</c:if>" aria-controls="sample-table-2"
															tabindex="0" id="sample-table-2_previous"><a
															href="javascript:void(0)" onclick="goPage(${maxPageNum})">尾页</a></li>
													</ul>
												</div>
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
					<!-- PAGE CONTENT ENDS -->
				</div>
				<!-- /.col -->
			</div>
			<!-- /.row -->
		</div>
		<!-- /.page-content-area -->
	</div>

</body>

<!-- basic scripts -->

<!--[if !IE]> -->
<script type="text/javascript">
	window.jQuery
			|| document
					.write("<script src='<%=request.getContextPath()%>/ace/assets/js/jquery.min.js'>"
							+ "<"+"/script>");
</script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='<%=request.getContextPath()%>/ace/assets/js/jquery1x.min.js'>"+"<"+"/script>");
</script>
<![endif]-->
<script type="text/javascript">
	if ('ontouchstart' in document.documentElement)
		document.write("<script src='<%=request.getContextPath()%>/ace/assets/js/jquery.mobile.custom.min.js'>"+ "<"+"/script>");
</script>

<script type="text/javascript">
	function goPage(pageNum){
		if(${pageNum}==1 && pageNum<=1){
			return false;
		}
		if(${pageNum==maxPageNum} && pageNum>=${maxPageNum}){
			return false;
		}
		
		if(pageNum!=0){
			$("#pageNum").val(pageNum);
		}
		var myreg=/^[0-9]*$/;
		if(!myreg.test($("#pageNum").val())){
			alert("请输入有效数字！");
			$("#pageNum").val(1);
			return false;
		}
		$("#drizzt-table").submit();
	}
	
	function goOperate(operate,uuid){
		if(operate=="add"){
			$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbExpertQu/toAdd.do");
			$("#drizzt-table").submit();
		}
		if(operate=="edit"){
			//var val=$("#uuid:checked").val();
			var val=uuid;
			if(val==null){
                alert("请选择一条数据");
                return false;
            }else{
				$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbExpertQu/"+uuid+"/update");
				$("#drizzt-table").submit();
            }
		}
		if(operate=="del"){
			var val=$("#uuid:checked").val();
			if(val==null){
                alert("请选择一条数据");
                return false;
            }else{
            	if(confirm("确定要删除该信息吗？删除将不能恢复！")){
            		$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbExpertQu/del.do");
     				$("#drizzt-table").submit();
            	}else{
            		return false;
            	}
            }
		}
		
		//<%=request.getContextPath()%>/bsbExpertQu/${bsbExpertQu.uuid}/show
		if(operate=="view"){
			var val=$("#uuid:checked").val();
			if(val==null){
                alert("请选择一条数据");
                return false;
            }else{
				$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbExpertQu/view.do");
				$("#drizzt-table").submit();
            }
		}
		if(operate=="hide"){
			var val=uuid;
			if(val==null){
                alert("请选择一条数据");
                return false;
            }else{
				$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbExpertQu/"+uuid+"/hide");
				$("#drizzt-table").submit();
            }
		}
		if(operate=="show"){
			var val=uuid;
			if(val==null){
                alert("请选择一条数据");
                return false;
            }else{
				$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbExpertQu/"+uuid+"/show");
				$("#drizzt-table").submit();
            }
		}
		
	}
</script>
<script
	src="<%=request.getContextPath()%>/ace/assets/js/bootstrap.min.js"></script>
<script
	src="<%=request.getContextPath()%>/ace/assets/js/bootstrap-datepicker.min.js"></script>
<script
	src="<%=request.getContextPath()%>/ace/assets/locales/bootstrap-datepicker.zh-CN.min.js"></script>
	
<script type="text/javascript">
jQuery(function($) {
	$("#datepicker").datepicker({
		dateFormat: "yy-mm-dd",
	    todayBtn: "linked",
	    clearBtn: true,
	    language: "zh-CN",
	    autoclose: true,
	    todayHighlight: true
		//isRTL:true,
	
		
		/*
		changeMonth: true,
		changeYear: true,
		
		showButtonPanel: true,
		beforeShow: function() {
			//change button colors
			var datepicker = $(this).datepicker( "widget" );
			setTimeout(function(){
				var buttons = datepicker.find('.ui-datepicker-buttonpane')
				.find('button');
				buttons.eq(0).addClass('btn btn-xs');
				buttons.eq(1).addClass('btn btn-xs btn-success');
				buttons.wrapInner('<span class="bigger-110" />');
			}, 0);
		}
	*/
	});
	
})

function search(){
	$("#pageNum").val(1);
	$("#drizzt-table").submit();
}
</script>
</html>
